package com.alibaba.nacos.plugin.datasource.impl.kingbase8;

import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.plugin.datasource.constants.TableConstant;
import com.alibaba.nacos.plugin.datasource.mapper.ConfigInfoTagMapper;
import com.alibaba.nacos.plugin.datasource.model.MapperContext;
import com.alibaba.nacos.plugin.datasource.model.MapperResult;

import static com.alibaba.nacos.plugin.datasource.constants.DefaultConstant.DEFAULT_TENANT_ID;

public class ConfigInfoTagMapperByKingbase8 extends AbstractKingbase8Mapper implements ConfigInfoTagMapper {
    


    @Override
    public MapperResult findAllConfigInfoTagForDumpAllFetchRows(MapperContext context) {
        int startRow = context.getStartRow();
        int pageSize = context.getPageSize();
        String innerSql = getDatabaseDialect().getLimitPageSqlWithOffset(
                "SELECT id FROM config_info_tag  ORDER BY id ", startRow, pageSize);

        return new MapperResult(" SELECT t.id,data_id,group_id,tenant_id,tag_id,app_name,content,md5,gmt_modified "
                + " FROM (  " + innerSql + "  ) ", CollectionUtils.list(new Object[0]));
    }


    @Override
    public String getTableName() {
        return TableConstant.CONFIG_INFO_TAG;
    }

    @Override
    public String getFunction(String s) {
        return s;
    }
}
